import {h,init} from 'snabbdom'
import style from 'snabbdom/modules/style'
import eventlisteners from 'snabbdom/modules/eventlisteners'

let patch = init([
    style,
    eventlisteners
])

let vnode = h('div',{
    style:{
        backgroundColor:'red'
    },
    on: {
        click: eventHandler
    }
},[
    h('h1','Hello Snabbdom'),
    h('p','这是p标签')
])

function eventHandler(){
    console.log('点击我了')
}

let app = document.querySelector('#app')
patch(app,vnode)